package _11_整理题目._3_字符串_递归_dfs_bfs_双指针._子串子序列_最值;


import org.junit.Test;

/**
 * https://leetcode-cn.com/problems/longest-continuous-increasing-subsequence/
 * 给定一个未经排序的整数数组，找到最长且 连续递增的子序列，并返回该序列的长度。
 * 
 */
public class _043_最长连续递增序列 {
    
    public int findLengthOfLCIS(int[] nums) {
        int max = 1;
        int count = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > nums[i-1]) {
                count++;
            } else {
                count = 1;
            }
            max = Math.max(max, count);
        }
        return max;
    }
    
    @Test
    public void main() {
        int[] nums = {1,3,5,4,7};
        assert findLengthOfLCIS(nums) == 3;
    }
    
}
